<?php

namespace app\models;

use app\models\CommicPages;
use yii\db\ActiveRecord;
use Yii;

class CommicPages extends ActiveRecord{
	
	
	public static function tableName(){
		// return "shop_admin";
		return "{{%CommicPages}}";
	}
	
	//uId 用户序号	uName 用户昵称	uMail 用户邮箱	uNumber 用户账号	uPassword 密码	uHeadurl 头像 state

	public function rules(){

    }

    public function attributeLabels(){
        return [
            'cId' => '漫画id',
            'cEpisodeName' => '漫画每一话对应的名字',
            'cEpisode' => '漫画第几集',
            'cPages' => '漫画总页数',
        ];
    }
    
    //插入数据
    public function insertCommic($data){
        //load是php框架内部自主加载数据的函数，而validate是自主验证rules
    }

    //根据cid获取某一漫画全部信息
    public function getPages($cId, $cEpisode){
        $data = self::find()->select(['cEpisodeName','cPages'])->where('cId = :cId and cEpisode = :cEpisode',[':cId'=>$cId,':cEpisode'=>$cEpisode])->asArray()->one();
        return $data;
    }
}
